﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe
{
    public partial class TaskInfo : Form
    {
        DataSet ImageList;
        public TaskInfo()
        {
            InitializeComponent();
        }

        private void TaskInfo_Load(object sender, EventArgs e)
        {
            skinLabel2.Text = Task.CallTime;
            skinLabel3.Text = Task.Dept;
            skinLabel5.Text = Task.CallUser;
            skinLabel7.Text = Task.State;
            skinLabel6.Text = Task.EGN;
            skinLabel8.Text = Task.Content;
            skinLabel14.Text = Task.EQName;

            DBS sop = new DBS();

            ImageList = sop.Task_Image_List(Task.Flag);


            if (ImageList.Tables[0].Rows.Count > 0)
                pictureBox1.ImageLocation = @"http://cmu.lichuanjia.cn/CMUImage/small_" + ImageList.Tables[0].Rows[0][2].ToString();

            if (ImageList.Tables[0].Rows.Count > 1)
                pictureBox2.ImageLocation = @"http://cmu.lichuanjia.cn/CMUImage/small_" + ImageList.Tables[0].Rows[1][2].ToString();

            if (ImageList.Tables[0].Rows.Count > 2)
                pictureBox3.ImageLocation = @"http://cmu.lichuanjia.cn/CMUImage/small_" + ImageList.Tables[0].Rows[2][2].ToString();

            if (ImageList.Tables[0].Rows.Count > 3)
                pictureBox4.ImageLocation = @"http://cmu.lichuanjia.cn/CMUImage/small_" + ImageList.Tables[0].Rows[3][2].ToString();
        }



        private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (ImageList.Tables[0].Rows[0][3].ToString().Equals("video"))
            {

                string url = ImageList.Tables[0].Rows[0][2].ToString().Replace("jpg", "mp4");

                System.Diagnostics.Process.Start("http://cmu4h.qiniudn.com/" + url);
            }
            else
            {
                ImageViewr iv = new ImageViewr(ImageList.Tables[0].Rows[0][2].ToString());
                iv.Show();
            }
        }
        private void pictureBox2_Click(object sender, EventArgs e)
        {


            if (ImageList.Tables[0].Rows[1][3].ToString().Equals("video"))
            {

                string url = ImageList.Tables[0].Rows[1][2].ToString().Replace("jpg", "mp4");

                System.Diagnostics.Process.Start("http://cmu4h.qiniudn.com/" + url);
            }
            else
            {


                ImageViewr iv = new ImageViewr(ImageList.Tables[0].Rows[1][2].ToString());
                iv.Show();
            }
        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {


            if (ImageList.Tables[0].Rows[2][3].ToString().Equals("video"))
            {

                string url = ImageList.Tables[0].Rows[2][2].ToString().Replace("jpg", "mp4");

                System.Diagnostics.Process.Start("http://cmu4h.qiniudn.com/" + url);
            }
            else
            {



                ImageViewr iv = new ImageViewr(ImageList.Tables[0].Rows[2][2].ToString());
                iv.Show();
            }
        }
        private void pictureBox4_Click(object sender, EventArgs e)
        {


            if (ImageList.Tables[0].Rows[3][3].ToString().Equals("video"))
            {

                string url = ImageList.Tables[0].Rows[3][2].ToString().Replace("jpg", "mp4");

                System.Diagnostics.Process.Start("http://cmu4h.qiniudn.com/" + url);
            }
            else
            {

                ImageViewr iv = new ImageViewr(ImageList.Tables[0].Rows[3][2].ToString());
                iv.Show();
            }
        }

        private void skinButton1_Click(object sender, EventArgs e)
        {
            Log_Item_List ll = new Log_Item_List(Task.Flag);
            ll.ShowDialog();
        }

        private void skinButton2_Click(object sender, EventArgs e)
        {
            DBS db = new DBS();
            db.DEL_Task_By_Flag(Task.Flag);
            this.Dispose();
        }
    }
}
